A view that owns the native Kanzi application and provides the output surface. More...
Classes | |
| enum | State |
| KanziView java-side lifecycle state. More... | |
Public Member Functions | |
| KanziView (Context context) | |
| Simple constructor to use when creating a KanziView from code. | |
| KanziView (Context context, AttributeSet attrs) | |
| Constructor that is called when inflating a KanziView from XML. | |
| void | createNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_CREATE events. | |
| void | destroyNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_DESTROY events. | |
| boolean | onKeyDown (final int keyCode, KeyEvent event) |
| A key down handler. | |
| boolean | onKeyUp (final int keyCode, KeyEvent event) |
| A key up handler. | |
| boolean | onTouchEvent (final MotionEvent event) |
| Handler for touches inside KanziView. | |
| void | pauseNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_PAUSE events. | |
| int | queueEvent (Runnable runnable) |
| Submits a runnable task to Kanzi's task dispatcher. | |
| void | registerLifecycle (Lifecycle lifecycle) |
| Attaches KanziView to the given Lifecycle. | |
| void | resumeNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_RESUME events. | |
| void | setOrientation (int orientation) |
| Handler for device/display orientation changes. | |
| void | startNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_START events. | |
| void | stopNativeApplication () |
Lifecycle handler for Lifecycle.Event.ON_STOP events. | |
| void | surfaceChanged (SurfaceHolder holder, int format, int width, int height) |
| This is called immediately after any structural changes (format or size) have been made to the surface. | |
| void | surfaceCreated (SurfaceHolder holder) |
| This is called immediately after the surface is first created. | |
| void | surfaceDestroyed (SurfaceHolder holder) |
| This is called immediately before a surface is being destroyed. | |
Protected Member Functions | |
| boolean | isActiveView () |
| Checks is this instance the same which was passed to the native application by createNativeApplication(). | |
| void | onFocusChanged (boolean gainFocus, int direction, Rect previouslyFocusedRect) |
| Called by the view system when the focus state of this KanziView changes. | |
Protected Attributes | |
| State | mState = State.IDLE |
| Current KanziView lifecycle state. | |
| Surface | mSurface = null |
| Valid Surface. | |
A view that owns the native Kanzi application and provides the output surface.
| KanziView | ( | Context | context | ) |
Simple constructor to use when creating a KanziView from code.
| context | The Context the KanziView is running in, through which it can access the current theme, resources, etc. |
| KanziView | ( | Context | context, |
| AttributeSet | attrs ) |
Constructor that is called when inflating a KanziView from XML.
| context | The Context the KanziView is running in, through which it can access the current theme, resources, etc. |
| attrs | The attributes of the XML tag that is inflating the KanziView. |
| void createNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_CREATE events.
Loads the native library providing all Kanzi functionality. Initializes the context and assigns this KanziView for rendering. Creates Kanzi application which loads the Kanzi project.
| void destroyNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_DESTROY events.
Halts and destroys the Kanzi application.
|
protected |
Checks is this instance the same which was passed to the native application by createNativeApplication().
|
protected |
Called by the view system when the focus state of this KanziView changes.
| gainFocus | True if the KanziView has focus; false otherwise. |
| direction | The direction focus has moved when requestFocus() is called to give this KanziView focus. |
| previouslyFocusedRect | The rectangle, in this KanziView's coordinate system, of the previously focused view. May be null. |
| boolean onKeyDown | ( | final int | keyCode, |
| KeyEvent | event ) |
A key down handler.
Passes the key down event to the key event handler.
| keyCode | A key code that represents the button pressed, from android.view.KeyEvent. |
| event | The KeyEvent object that defines the button action. |
| boolean onKeyUp | ( | final int | keyCode, |
| KeyEvent | event ) |
A key up handler.
Passes the key up event to the key event handler.
| keyCode | A key code that represents the button pressed, from android.view.KeyEvent. |
| event | The KeyEvent object that defines the button action. |
| boolean onTouchEvent | ( | final MotionEvent | event | ) |
Handler for touches inside KanziView.
Translates the received events into the native library's touch states.
| event | The motion event. |
| void pauseNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_PAUSE events.
Logs the event.
| int queueEvent | ( | Runnable | runnable | ) |
Submits a runnable task to Kanzi's task dispatcher.
This function fails if the task dispatcher is not yet initialized.
| runnable | The task to be run. |
| void registerLifecycle | ( | Lifecycle | lifecycle | ) |
Attaches KanziView to the given Lifecycle.
| lifecycle | The lifecycle to attach to. |
| void resumeNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_RESUME events.
Logs the event.
| void setOrientation | ( | int | orientation | ) |
Handler for device/display orientation changes.
Translates the received orientation qualifiers into the native library's orientation constants.
| orientation | The orientation qualifier from onOrientationChanged(). |
| void startNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_START events.
Runs the Kanzi application if a surface has already been received.
| void stopNativeApplication | ( | ) |
Lifecycle handler for Lifecycle.Event.ON_STOP events.
Stops the Kanzi application.
| void surfaceChanged | ( | SurfaceHolder | holder, |
| int | format, | ||
| int | width, | ||
| int | height ) |
This is called immediately after any structural changes (format or size) have been made to the surface.
This method is always called at least once, after com.rightware.kanzi.KanziView#surfaceCreated.
| holder | The SurfaceHolder whose surface has changed. |
| format | The new PixelFormat of the surface. |
| width | The new width of the surface. |
| height | The new height of the surface. |
| void surfaceCreated | ( | SurfaceHolder | holder | ) |
This is called immediately after the surface is first created.
Passes the created surface to the native library for rendering target.
| holder | The SurfaceHolder whose surface is being created. |
| void surfaceDestroyed | ( | SurfaceHolder | holder | ) |
This is called immediately before a surface is being destroyed.
| holder | The SurfaceHolder whose surface is being destroyed. |
|
protected |
Valid Surface.
The surface will be captured during the onSurfaceCreated event.